package com.xiao.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xiao.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController

public class UserController {


    @Autowired
    private UserService userService;

    private  ObjectMapper objectMapper = new ObjectMapper();







    @RequestMapping("/all")
    public Object getAll() throws JsonProcessingException {

        return  objectMapper.writeValueAsString(userService.findAllUser());
    }

}
